# -*- coding: utf-8 -*-
# !/usr/bin/env python
from rest_framework.views import APIView
from components.kubernetes.dao import get_env_k8s_cluster, get_env_k8s_cluster_all
from utils.views import Result

class EnvK8sCluster(APIView):
    def get(self, request):
        data = request.query_params

        if data.get("env_id"):
            env_cluster_data = get_env_k8s_cluster(data['env_id'])
        else:
            env_cluster_data = get_env_k8s_cluster_all()
        return Result.success_response(data=env_cluster_data, msg='查询成功')